package com.hafu.dao;

import com.hafu.model.RuKuDetail;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class RuKuDetailDao {
    public boolean addRuKuDetail(RuKuDetail rukudetail, Connection conn)throws SQLException{
        String sql="insert into ruku_detail(ruku_id,sp_name,price,num)values(?,?,?,?)";
        PreparedStatement preparedStatement = conn.prepareStatement(sql);
        preparedStatement.setInt(1,rukudetail.getRukuId());
        preparedStatement.setString(2,rukudetail.getSpName());
        preparedStatement.setBigDecimal(3,rukudetail.getPrice());
        preparedStatement.setInt(4,rukudetail.getNum());
        int i=preparedStatement.executeUpdate();
        if (i>0){
            return true;
        }else {
            return false;
        }
    }
}
